package io.renren.service.impl;

import com.alibaba.fastjson.JSONObject;
import io.renren.entity.SysUserEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

import io.renren.dao.BusinesspayDao;
import io.renren.entity.BusinesspayEntity;
import io.renren.service.BusinesspayService;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;


@Transactional(propagation= Propagation.REQUIRED)
@Service("businesspayService")
public class BusinesspayServiceImpl implements BusinesspayService {
	/**
	 * 日志对象
	 */

	Logger logger = LoggerFactory.getLogger(getClass());
	@Autowired
	private BusinesspayDao businesspayDao;
	@Override
	public BusinesspayEntity queryObject(Integer id){
		return businesspayDao.queryObject(id);
	}
	
	@Override
	public List<BusinesspayEntity> queryList(Map<String, Object> map){
		return businesspayDao.queryList(map);
	}
	
	@Override
	public int queryTotal(Map<String, Object> map){
		return businesspayDao.queryTotal(map);
	}
	
	@Override
	public void save(BusinesspayEntity businesspay){
		businesspayDao.save(businesspay);
	}

	@Override
	public void update(BusinesspayEntity businesspay){
		businesspayDao.update(businesspay);
	}
	
	@Override
	public void delete(Integer id){
		businesspayDao.delete(id);
	}
	
	@Override
	public void deleteBatch(Integer[] ids){
		businesspayDao.deleteBatch(ids);
	}

	@Override
	public void simpleAudit(JSONObject params, SysUserEntity sysUserEntity) {
		BusinesspayEntity businesspayEntity = new BusinesspayEntity();
		businesspayEntity.setId(Integer.parseInt(params.get("id").toString()));
			businesspayEntity.setAudit(params.get("audit").toString());
			businesspayEntity.setAuditperson(sysUserEntity.getUsername());
			businesspayEntity.setAuditdate(new Date());
			businesspayDao.simpleAudit(businesspayEntity);

	}

}
